package wechat.rcv.util;

import org.apache.log4j.Logger;

import weixin.mp.aes.AesException;
import weixin.mp.aes.WXBizMsgCrypt;

public class RcvToken {
	final public static Logger logger = Logger.getLogger(RcvToken.class.getName());
//	final public static String WECHAT_CORP_ID = "wx8f929502ae3cd538";
//	final public static String sToken = "Na2KrKGTcidUhwDlSVHW35";
//	final public static String sEncodingAESKey = "WD5QyNaUe6vLGBVUycfEQxfAba0FeuXozPPZLx2dsmX";
	
	//Lanmon-info  
//	final public static String WECHAT_CORP_ID = "wx89f88f98210ded84";
//	final public static String sToken = "yyrDO";
//	final public static String sEncodingAESKey = "1oFZ0T0DGe0s4rZpOX3pzJ83YhCUJZFnurG3QOeZFtk";
//	
//	final public static String WECHAT_SERVICE_APP_ID = "wx4bfa441f37c72005";
	
	
	final public static String WECHAT_CORP_ID = "wx01ad0d700af56f26";
	final public static String sToken = "weixin";
	final public static String sEncodingAESKey = "87f6a972e47ee424d299970ce727ee60";
	
	final public static String WECHAT_SERVICE_APP_ID = "wx01ad0d700af56f26";
	
	public static WXBizMsgCrypt wxcpt = null;
	public static WXBizMsgCrypt getWxcpt() {
		if (wxcpt == null) {
			logger.info("CorpId = "+ WECHAT_CORP_ID);
			logger.info("sToken = "+ sToken);
			logger.info("sEncodingAESKey = "+ sEncodingAESKey);

			try {
				wxcpt = new WXBizMsgCrypt(sToken, sEncodingAESKey, WECHAT_CORP_ID);
			} catch (AesException e) {
				logger.info("Failed to cretate WXBizMsgCrypt");
			}
		}
		return wxcpt;
	}
	public static WXBizMsgCrypt getServiceAppWxcpt() {
		if (wxcpt == null) {
			logger.info("AppID = "+ WECHAT_SERVICE_APP_ID);
			logger.info("sToken = "+ sToken);
			logger.info("sEncodingAESKey = "+ sEncodingAESKey);

			try {
				wxcpt = new WXBizMsgCrypt(sToken, sEncodingAESKey, WECHAT_CORP_ID);
			} catch (AesException e) {
				logger.info("Failed to cretate WXBizMsgCrypt");
			}
		}
		return wxcpt;
	}
	public static String getToken(){
		return sToken;
	}
}
